package com.qsl.ssyx.search.repository;

import com.qsl.ssyx.model.search.SkuEs;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

// ES   继承ElasticsearchRepository主要是继承基本增、删、该、查等接口， ElasticsearchRepository<实体类,实体类主键类型>
public interface SkuRepository extends ElasticsearchRepository<SkuEs, Long> {

    //    获取10件爆款商品
    List<SkuEs> findByOrderByHotScoreDesc(PageRequest pageRequest);

    //    根据仓库id+分类id查询
    Page<SkuEs> findByWareIdAndCategoryId(Long wareId, Long categoryId, Pageable pageable);

    //    根据仓库id+keyword查询。
    Page<SkuEs> findByKeywordAndWareId(String keyword, Long wareId, Pageable pageable);
}
